<?php
namespace app\common\model;

use think\Model;

class User extends Model
{
    public function addUser($data){
        $return_data = ['status' =>0, 'msg' => '', 'data' => ''];
        try{
            $this->allowField([])->save($data);
            if($this->id){
                $return_data['status'] = 1;
                $return_data['data'] = $this->id;
                $return_data['msg'] = 'success';
                return $return_data;
            }
        }catch (\Exception $e){
        }
        return $return_data;
    }


    /*
     *  通过邀请码获取用户信息
     * */
    public function userInfoByShareCode($share_code)
    {
        return $this->where([['share_code', '=', $share_code]])->find();
    }

    /*
     *  获取用户信息
     * */
    public function userInfoByAddress($address){
        return $this->where([['address', '=', $address]])->find();
    }





}